#ifndef _TBDIR_H_
#define _TBDIR_H_

#include "TBSettings.h"

#include "TBString2.h"
#include "TBFile.h"

#include <list>

namespace tb
{

	/*
		Special directories:

		@ExeDir@       -   Path where the executable resides
		@WorkingDir@   -   Working directory
		@MyDocuments@  -   My Documents folder for this user
		@MyGames@      -   My Games folder (My Documents\\My Games)
		@FontDir@      -   Font directory for Windows
	*/

	class TB_DLL_FUNC Dir
	{
	
	public:
	
		Dir(const String& a_Path, bool a_Relative = true);
		~Dir();

		bool SetPath(const String& a_Path);
		String& GetPath();

		bool ChangeDirectory(const String& a_RelativePath);

		String GetAbsolutePath();
		String GetRelativePath(const String& a_Relative);

		Dir& operator + (const String& a_FileName);
	
	private:

		void _ResolvePath(String& a_Target, const String& a_Base);

		String* m_Path;
		String* m_CachedAbsolutePath;
		bool m_CacheDirty;
	
	}; // class Dir

}; // namespace tb
	
#endif